<template>
  <h1>父组件的钱： {{ money }}</h1>
  <!-- <child-a :money="money" @change-money="changeMoney"> -->
  <child-a v-model:money="money">
  <!--
    语法糖：解析成如下代码
    <child-a :money="money" @update:money="changeMoney"> 
  -->
  </child-a>
</template>
<script>
import { ref } from 'vue'
import ChildA from './components/child-a.vue'
export default {
  name: 'App',
  setup() {
    let money = ref(1000000)
    const changeMoney = newMoney => {
      console.log(newMoney)
      money.value += newMoney
    }
    return {
      money,
      changeMoney
    }
  },
  components: {
    ChildA
  }
}
</script>